<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a1 {
            width: 300px;
            height: 300px;
            background-color: red;
        }
        .a2 {
            width: 200px;
            height: 200px;
            background-color: blue;
        }
        .a3 {
           
            width: 100px;
            height:100px ;
            background-color: white;
    
        }
    </style>
</head>
<body>
    <div>
        <div id="app">
            <div class="a1" @click.capture="click1">
                <!-- .capture事件修饰符的作用是添加时间监听器时使用事件捕获模式 -->
                <!-- 就是给元素添加一个监听器，当元素发生冒泡时，先触发带有该修饰符的元素。若有多个该修饰符，则是由外而内触发。就是给有该事件修饰符，就先触发谁 -->
                <div @click.capture="click2" class="a2">
                    <div @click.capture="click3" class="a3">
                        {{msg2}}
                    </div>
                </div>
            </div>
        </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var vm = new Vue({
            el:'#app',
            data:{
                msg:'hellowolrd',
                msg2:'你好世界'
            },
            methods: {
            click1() {
                console.log("click1")
            },
            click2() {
                console.log("click2")
            },
            click3(){
                console.log('click3')
            }
        }
        })
 
     
    

    </script>
</body>
</html>